import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

const routes = [
    {
        path: '/',
        name: 'home',
        component: () => import('../views/home/home.vue'),
    },
    {
        path: '/study',
        name: 'study',
        component: () => import('../views/study/study.vue')

    },
    {
        path: '/studyJobIn',
        name: 'studyJobIn',
        // 子路由的组件会被渲染到父路由组件的路由出口内
        component: () => import('@/views/study/studyJobIn.vue'),
    },
    {
        path: '/studyPage',
        name: 'studyPage',
        component: () => import('../views/study/studyPage.vue'),
        redirect: '/studyPage/studyDetails',
        children: [{
            path: 'studyDetails',
            name: 'studyDetails',
            // 子路由的组件会被渲染到父路由组件的路由出口内
            component: () => import('@/views/study/studyDetails')
        }, {
            path: 'studyJob',
            name: 'studyJob',
            // 子路由的组件会被渲染到父路由组件的路由出口内
            component: () => import('@/views/study/studyJob')
        }, ]
    },
    {
        path: '/user',
        name: 'userCenter',
        component: () => import('@/views/personalCenter/userCenter.vue'),
        redirect: '/user/myProject',
        children: [
            // 添加子路由
            {
                path: 'myProject',
                name: 'myProject',
                // 子路由的组件会被渲染到父路由组件的路由出口内
                component: () => import('@/views/personalCenter/check/myProject')
            },
            {
                path: 'myPractice',
                name: 'myPractice',
                // 子路由的组件会被渲染到父路由组件的路由出口内
                component: () => import('@/views/personalCenter/check/myPractice')
            },
            {
                path: 'myWiki',
                name: 'myWiki',
                // 子路由的组件会被渲染到父路由组件的路由出口内
                component: () => import('@/views/personalCenter/check/myWiki')
            },
            {
                path: 'myAchievement',
                name: 'myAchievement',
                // 子路由的组件会被渲染到父路由组件的路由出口内
                component: () => import('@/views/personalCenter/check/myAchievement')
            },
            {
                path: 'myIntegral',
                name: 'myIntegral',
                // 子路由的组件会被渲染到父路由组件的路由出口内
                component: () => import('@/views/personalCenter/check/myIntegral')
            },
        ]
    },
    {
        path: '/editUserInfo',
        name: 'editUserInfo',
        component: () => import('@/views/personalCenter/editUserInfo')
    },
    {
        path: '/wikiKnowledge',
        name: 'wikiKnowledge',
        component: () => import('@/views/wikiKnowledge/wikiKnowledge')
    },
    {
        path: '/wikiDetails',
        name: 'wikiDetails',
        component: () => import('@/views/wikiKnowledge/wikiDetails')
    },
    {
        path: '/onlinePractice',
        name: 'onlinePractice',
        component: () => import('@/views/onlinePractice/onlinePractice')
    },
    {
        path: '/practiceIntroduce',
        name: 'practiceIntroduce',
        component: () => import('@/views/onlinePractice/practiceIntroduce/practiceIntroduce')
    },
    {
        path: '/oneSelect',
        name: 'oneSelect',
        component: () => import('@/views/onlinePractice/titleType/oneSelect')
    },
]

const router = new VueRouter({
    mode: 'hash',
    base: process.env.BASE_URL,
    routes
})

export default router
